package org.happy.tester.common.http.resp;

import java.io.Serializable;

/**
 * Description
 *
 * @author baijingchuan
 * Date 2020/6/9
 **/
public class BaseResponse<T> implements Serializable {

    private static final long serialVersionUID = 7541278246767868557L;

    private Integer code;

    private String msg;

    private T data;

    @Override
    public String toString() {
        return "BaseResponse{" +
                "code=" + code +
                ", msg=" + msg +
                ", data=" + data +
                '}';
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public BaseResponse success() {
        this.code = 200;
        this.msg = "SUCCESS";
        return this;
    }

    public boolean isSuccess() {
        boolean success = false;
        if (this.code == 200) {
            success = true;
        }
        return success;
    }
}
